package com.tonysor.hadoop.mapreduce;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class WordReduce extends Reducer<Text, LongWritable, Text, LongWritable>{

	@Override
	protected void reduce(Text key, Iterable<LongWritable> values,
			Reducer<Text, LongWritable, Text, LongWritable>.Context ctx) throws IOException, InterruptedException {
		
		long num =0;
		for(LongWritable s : values) {
			num += s.get();
		}
		ctx.write(key,new LongWritable(num));
	}

}
